<?php
include 'connect.php';
 if (isset($_GET['page'])) 
            {
                $page = $_GET['page'];
            } 
        else 
            {
                $page = 1;
            }
$offset = ($page - 1) * $limit;
    if (isset($_GET['dmcha']))
     {
     $querry =$con->query("select * from product where categoryid= {$dmcha} LIMIT {$limit} OFFSET {$offset}");
     }
    elseif (isset($_GET['dmcon']))
     {
        $querry =$con->query("select * from product where categorydetailid= {$dmcon} LIMIT {$limit} OFFSET {$offset}");
     }
            else
            {
                $querry =$con->query("select * from product LIMIT {$limit} OFFSET {$offset}");
            }
     
while ($row = mysqli_fetch_array($querry))
{
?>
            <div class="bsp">
                <form method="post" action="cart.php">
                <input type="hidden" name="name" value="<?php echo $row["name"]; ?>">
                <input type="hidden" name="id" value="<?php echo $row["id"]; ?>">
                <input type="hidden" name="price" value="<?php echo $row["price"]; ?>">
                <input type="hidden" name="image" value="<?php echo $row["image"]; ?>">
                <input type="hidden" name="num" value="1">
                <a href="listdetail.php?qa=<?php echo $row['id']; ?>"><img src="<?php echo $row["image"] ?>"/></a>
                <div class="bgia"><?php echo $row["name"]; ?></div>
                <div class="bgia"><div class="btext">Giá: </div><div class="color"><?php echo $row["price"] . " VNĐ"; ?></div></div>
                <div class="bgia"><input type="submit" value="Thêm vào giỏ hàng" name="addcart"/></div>
                </form>
            </div>
 <?php
}
 ?> 